package sm.codec.api;

import sm.codec.ArrayCodec;
import sm.codec.CharacterCodec;
import sm.codec.DBDictCodec;
import sm.codec.ExpressionCodec;
import sm.codec.GlobalVariableCodec;
import sm.codec.LabelCodec;
import sm.codec.LocalVariableCodec;
import sm.codec.LogicalCodec;
import sm.codec.MemberCodec;
import sm.codec.NumberCodec;
import sm.codec.OffsetCodec;
import sm.codec.OperatorCodec;
import sm.codec.PseudoCodec;
import sm.codec.RCCodec;
import sm.codec.RecordCodec;
import sm.codec.StructureCodec;
import sm.codec.TimeCodec;
import sm.def.Type;

public final class CodecFactory {
	public static final Codec NUMBER_CODEC = new NumberCodec();

	public static final Codec CHARACTER_CODEC = new CharacterCodec();

	public static final Codec TIME_CODEC = new TimeCodec();

	public static final Codec LOGICAL_CODEC = new LogicalCodec();

	public static final Codec LABEL_CODEC = new LabelCodec();

	public static final Codec RECORD_CODEC = new RecordCodec();

	public static final Codec OFFSET_CODEC = new OffsetCodec();

	public static final Codec ARRAY_CODEC = new ArrayCodec();

	public static final Codec STRUCTURE_CODEC = new StructureCodec();

	public static final Codec OPERATOR_CODEC = new OperatorCodec();

	public static final Codec EXPRESSION_CODEC = new ExpressionCodec();

	public static final Codec PSEUDO_CODEC = new PseudoCodec();

	public static final Codec LOCAL_VARIABLE_CODEC = new LocalVariableCodec();

	public static final Codec GLOBAL_VARIABLE_CODEC = new GlobalVariableCodec();

	public static final Codec MEMBER_CODEC = new MemberCodec();

	public static final Codec RC_CODEC = new RCCodec();

	public static final Codec DBDICT_CODEC = new DBDictCodec();

	public static Codec getCodec(int type) {
		switch (type) {
		case Type.NUMBER_TYPE:
			return NUMBER_CODEC;
		case Type.CHARACTER_TYPE:
			return CHARACTER_CODEC;
		case Type.TIME_TYPE:
			return TIME_CODEC;
		case Type.LOGICAL_TYPE:
			return LOGICAL_CODEC;
		case Type.LABEL_TYPE:
			return LABEL_CODEC;
		case Type.RECORD_TYPE:
			return RECORD_CODEC;
		case Type.OFFSET_TYPE:
			return OFFSET_CODEC;
		case Type.ARRAY_TYPE:
			return ARRAY_CODEC;
		case Type.STRUCTURE_TYPE:
			return STRUCTURE_CODEC;
		case Type.OPERATOR_TYPE:
			return OPERATOR_CODEC;
		case Type.EXPRESSION_TYPE:
			return EXPRESSION_CODEC;
		case Type.PSEUDO_TYPE:
			return PSEUDO_CODEC;
		case Type.LOCALVARIABLE_TYPE:
			return LOCAL_VARIABLE_CODEC;
		case Type.GLOBALVARIABLE_TYPE:
			return GLOBAL_VARIABLE_CODEC;
		case Type.MEMBER_TYPE:
			return MEMBER_CODEC;
		default:
			return CHARACTER_CODEC;
		}
	}
}
